package com.wad.manager.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wad.dto.product.CategoryBrandDto;
import com.wad.entity.product.CategoryBrand;
import com.wad.manager.mapper.CategoryBrandMapper;
import com.wad.manager.service.CategoryBrandService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wad
 * @date 2023/12/08 11:11
 * @project e-commerce
 **/

@Service
public class CategoryBrandServiceImpl implements CategoryBrandService {


    @Resource
    private CategoryBrandMapper categoryBrandMapper;
    @Override
    public PageInfo<CategoryBrand> findByPage(Integer page, Integer limit, CategoryBrandDto categoryBrandDto) {
        PageHelper.startPage(page,limit);
        List<CategoryBrand> categoryBrandList=categoryBrandMapper.findByPage(categoryBrandDto);
        PageInfo<CategoryBrand> pageInfo=new PageInfo<>(categoryBrandList);
        return pageInfo;
    }


    @Override
    public void save(CategoryBrand categoryBrand) {
        categoryBrandMapper.save(categoryBrand);
    }

    @Override
    public void update(CategoryBrand categoryBrand) {
        categoryBrandMapper.update(categoryBrand);
    }


    @Override
    public void deleteById(Long id) {
        categoryBrandMapper.deleteById(id);
    }
}
